﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Inventory.Business.Services;

namespace Inventory.Test
{
    /// <summary>
    /// Summary description for AveraegPriceQuantityServiceTest
    /// </summary>
    [TestClass]
    public class AveragePriceQuantityServiceTest
    {
        //[TestMethod]
        //public void TestSetWarehouseQuantity()
        //{
        //    var icommit = AveragePriceQuantityService.SetWarehouse(new QuantityChange()
        //        {
        //            Warehouse = 68,
        //            Area = Inventory.Business.BusinessEntity.Area.Inventory,
        //            Materials = new List<MaterialWithQuantityAndArea>()
        //            {
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19177,
        //                    Quantity=10
        //                },
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19183,
        //                    Quantity=20
        //                },
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19178,
        //                    Quantity=1199
        //                }
        //            }
        //        });
        //    Assert.IsTrue(icommit.Commit());
        //}

        //[TestMethod]
        //public void TestSetWarehousePriceQuantity()
        //{
        //    var icommit = AveragePriceQuantityService.SetWarehouse(new PriceQuantityChange()
        //    {
        //        Warehouse = 68,
        //        Area = Inventory.Business.BusinessEntity.Area.Inventory,
        //        Materials = new List<UMaterialQuantityPrice>()
        //            {
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19177,
        //                    Quantity=10.5M,
        //                    Price = 10
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19183,
        //                    Quantity=20.5M,
        //                    Price = 11
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19178,
        //                    Quantity=1100,
        //                    Price = 15
        //                }
        //            }
        //    });
        //    Assert.IsTrue(icommit.Commit());
        //}

        //[TestMethod]
        //public void TestCalculateThenUpdateWarehouseQauntity()
        //{
        //    var icommit = AveragePriceQuantityService.CalculateThenUpdateWarehouse(new QuantityChange()
        //    {
        //        Warehouse = 68,
        //        Area = Inventory.Business.BusinessEntity.Area.Inventory,
        //        Materials = new List<MaterialWithQuantityAndArea>()
        //            {
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19177,
        //                    Quantity=10.5M
        //                },
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19183,
        //                    Quantity=20.5M
        //                },
        //                new MaterialWithQuantityAndArea()
        //                {
        //                    Material=19178,
        //                    Quantity=1.5M
        //                }
        //            }
        //    });
        //    Assert.IsTrue(icommit.Commit());
        //}

        //[TestMethod]
        //public void TestCalculateThenUpdateWarehousePriceQuantity()
        //{
        //    var icommit = AveragePriceQuantityService.CalculateThenUpdateWarehouse(new PriceQuantityChange()
        //        {
        //            Warehouse = 68,
        //            Area = Inventory.Business.BusinessEntity.Area.Inventory,
        //            Materials = new List<UMaterialQuantityPrice>()
        //            {
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19177,
        //                    Quantity=10.5M,
        //                    Price = 20
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19183,
        //                    Quantity=20.5M,
        //                    Price = 22
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19178,
        //                    Quantity=1100,
        //                    Price = 30
        //                }
        //            }
        //        });
        //    Assert.IsTrue(icommit.Commit());

        //}

        //[TestMethod]
        //public void TestMoveBetweenAreas()
        //{
        //    var icommit = AveragePriceQuantityService.MoveBetweenAreas(new MoveBetweenAreas()
        //    {
        //        Warehouse = 68,
        //        Area = Inventory.Business.BusinessEntity.Area.Inventory,
        //        AreaReceiving = Inventory.Business.BusinessEntity.Area.Quarantine,
        //        Materials = new List<UMaterialQuantityPrice>
        //            {
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19177,
        //                    Quantity=10.5M,
        //                    Price = 20
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19183,
        //                    Quantity=20.5M,
        //                    Price = 22
        //                },
        //                new UMaterialQuantityPrice()
        //                {
        //                    Material=19178,
        //                    Quantity=1100,
        //                    Price = 30
        //                }
        //            }
        //    });
        //    Assert.IsTrue(icommit.Commit());
        //}

        [TestMethod]
        public void CalculateThenUpdateWarehouseTheTwoArgumentTestTheEmptyLists()
        {
            var test = "test";
            var iCommit = AveragePriceQuantityService.CalculateThenUpdateWarehouse(
                new QuantityChange()
                {
                    Warehouse = 1
                }, new PriceQuantityChange()
                {
                    Warehouse = 1
                });
            Assert.IsTrue(iCommit.Commit());
        }
    }
}
